<script>
init({
  title: 'Detail Formatter',
  desc: 'Use `detailFormatter` to Format your detail view when `detailView` and `detailViewByClick` is set to `true`. Return a `String` and it will be appended into the detail view cell.',
  links: ['bootstrap-table.min.css'],
  scripts: ['bootstrap-table.min.js']
})
</script>

<template>
  <table
    id="table"
    data-toggle="table"
    data-height="460"
    data-detail-view="true"
    data-detail-view-by-click="true"
    data-detail-view-icon="false"
    data-show-columns="true"
    data-url="json/data1.json"
  >
    <thead>
      <tr>
        <th
          data-field="id"
          data-detail-formatter="idDetailFormatter"
        >
          ID
        </th>
        <th
          data-field="name"
          data-detail-formatter="nameDetailFormatter"
        >
          Item Name
        </th>
        <th
          data-field="price"
          data-detail-formatter="priceDetailFormatter"
        >
          Item Price
        </th>
      </tr>
    </thead>
  </table>
</template>

<script>
  window.idDetailFormatter = (index, row) => `${index}. Item ID: ${row.id}`
  window.nameDetailFormatter = (index, row) => `${index}. Item Name: ${row.name}`
  window.priceDetailFormatter = (index, row) => `${index}. Item Price: ${row.price}`
</script>
